{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a9aff49a-937a-425a-bd4f-56b0512accc1",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "6b582336-9976-4051-a236-21a72f278238",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv(\"气象预报.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "06bea22a-c467-4fce-8d0c-4b455ba60d0e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['WINDDIRECT', 'WINDSPEED', 'DDATETIME', 'ISBUILDWORD', 'MINRAIN',\n",
       "       'SYNC_ROWNUM', 'QPFRAIN', 'QPFISEDIT', 'MINTEMPERATURE', 'ISNEXTDAY',\n",
       "       'FORECASTER', 'MAXTEMPERATURE', 'KEYID', 'WRITETIME',\n",
       "       'QPFWEATHERSTATUS', 'HUMIDITY', 'WEATHERSTATUS', 'CRTTIME', 'RECID',\n",
       "       'QPFWEATHERPIC', 'WINDGUST', 'RAIN', 'MAXHUMIDITY', 'ISEDIT',\n",
       "       'WEATHERPIC', 'AREANAME', 'PRIMARYFORECASTER'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8e548bb0-26a0-4ce0-8cad-2d10d7892d33",
   "metadata": {},
   "outputs": [],
   "source": [
    "df2 = df[['WINDDIRECT', 'WINDSPEED', 'DDATETIME', 'ISBUILDWORD', 'MINRAIN','AREANAME', 'PRIMARYFORECASTER']].drop_duplicates()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "6538044a-6f12-462d-8ac3-a3362a198a49",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>WINDDIRECT</th>\n",
       "      <th>WINDSPEED</th>\n",
       "      <th>DDATETIME</th>\n",
       "      <th>ISBUILDWORD</th>\n",
       "      <th>MINRAIN</th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>PRIMARYFORECASTER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>盐田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>宝安区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9995</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>龙华新区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9996</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>大鹏新区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9997</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9998</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9999</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7520 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     WINDDIRECT WINDSPEED            DDATETIME  ISBUILDWORD  MINRAIN AREANAME  \\\n",
       "0            东北         3  2015-01-07 16:00:00            0      0.0      福田区   \n",
       "2            东北         3  2015-01-07 16:00:00            0      0.0      罗湖区   \n",
       "4            东北         3  2015-01-07 16:00:00            0      0.0      南山区   \n",
       "6            东北         3  2015-01-07 16:00:00            0      0.0      盐田区   \n",
       "8            东北         3  2015-01-07 16:00:00            0      0.0      宝安区   \n",
       "...         ...       ...                  ...          ...      ...      ...   \n",
       "9995          东       2-3  2015-09-17 06:00:00            0      0.0     龙华新区   \n",
       "9996          东       2-3  2015-09-17 06:00:00            0      0.0     大鹏新区   \n",
       "9997          东       2-3  2015-09-17 11:00:00            0      0.0      福田区   \n",
       "9998          东       2-3  2015-09-17 11:00:00            0      0.0      罗湖区   \n",
       "9999          东       2-3  2015-09-17 11:00:00            0      0.0      南山区   \n",
       "\n",
       "     PRIMARYFORECASTER  \n",
       "0                    -  \n",
       "2                    -  \n",
       "4                    -  \n",
       "6                    -  \n",
       "8                    -  \n",
       "...                ...  \n",
       "9995                 -  \n",
       "9996                 -  \n",
       "9997                 -  \n",
       "9998                 -  \n",
       "9999                 -  \n",
       "\n",
       "[7520 rows x 7 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "083e1ef5-8079-4c5c-b9aa-8310d4a4a67b",
   "metadata": {},
   "outputs": [],
   "source": [
    "df3 =df2.groupby(\"AREANAME\")[\"WINDSPEED\"].transform(\"min\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "762d8089-f291-413d-bb31-e0910eb5d564",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>WINDDIRECT</th>\n",
       "      <th>WINDSPEED</th>\n",
       "      <th>DDATETIME</th>\n",
       "      <th>ISBUILDWORD</th>\n",
       "      <th>MINRAIN</th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>PRIMARYFORECASTER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>盐田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>宝安区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9995</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>龙华新区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9996</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>大鹏新区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9997</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9998</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9999</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7520 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     WINDDIRECT WINDSPEED            DDATETIME  ISBUILDWORD  MINRAIN AREANAME  \\\n",
       "0            东北         3  2015-01-07 16:00:00            0      0.0      福田区   \n",
       "2            东北         3  2015-01-07 16:00:00            0      0.0      罗湖区   \n",
       "4            东北         3  2015-01-07 16:00:00            0      0.0      南山区   \n",
       "6            东北         3  2015-01-07 16:00:00            0      0.0      盐田区   \n",
       "8            东北         3  2015-01-07 16:00:00            0      0.0      宝安区   \n",
       "...         ...       ...                  ...          ...      ...      ...   \n",
       "9995          东       2-3  2015-09-17 06:00:00            0      0.0     龙华新区   \n",
       "9996          东       2-3  2015-09-17 06:00:00            0      0.0     大鹏新区   \n",
       "9997          东       2-3  2015-09-17 11:00:00            0      0.0      福田区   \n",
       "9998          东       2-3  2015-09-17 11:00:00            0      0.0      罗湖区   \n",
       "9999          东       2-3  2015-09-17 11:00:00            0      0.0      南山区   \n",
       "\n",
       "     PRIMARYFORECASTER  \n",
       "0                    -  \n",
       "2                    -  \n",
       "4                    -  \n",
       "6                    -  \n",
       "8                    -  \n",
       "...                ...  \n",
       "9995                 -  \n",
       "9996                 -  \n",
       "9997                 -  \n",
       "9998                 -  \n",
       "9999                 -  \n",
       "\n",
       "[7520 rows x 7 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "84a9f1dd-4b3d-4178-8df9-82055fbf425a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>WINDDIRECT</th>\n",
       "      <th>WINDSPEED</th>\n",
       "      <th>DDATETIME</th>\n",
       "      <th>ISBUILDWORD</th>\n",
       "      <th>MINRAIN</th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>PRIMARYFORECASTER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>盐田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>宝安区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9995</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>龙华新区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9996</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>大鹏新区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9997</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9998</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9999</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7507 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     WINDDIRECT WINDSPEED            DDATETIME  ISBUILDWORD  MINRAIN AREANAME  \\\n",
       "0            东北         3  2015-01-07 16:00:00            0      0.0      福田区   \n",
       "2            东北         3  2015-01-07 16:00:00            0      0.0      罗湖区   \n",
       "4            东北         3  2015-01-07 16:00:00            0      0.0      南山区   \n",
       "6            东北         3  2015-01-07 16:00:00            0      0.0      盐田区   \n",
       "8            东北         3  2015-01-07 16:00:00            0      0.0      宝安区   \n",
       "...         ...       ...                  ...          ...      ...      ...   \n",
       "9995          东       2-3  2015-09-17 06:00:00            0      0.0     龙华新区   \n",
       "9996          东       2-3  2015-09-17 06:00:00            0      0.0     大鹏新区   \n",
       "9997          东       2-3  2015-09-17 11:00:00            0      0.0      福田区   \n",
       "9998          东       2-3  2015-09-17 11:00:00            0      0.0      罗湖区   \n",
       "9999          东       2-3  2015-09-17 11:00:00            0      0.0      南山区   \n",
       "\n",
       "     PRIMARYFORECASTER  \n",
       "0                    -  \n",
       "2                    -  \n",
       "4                    -  \n",
       "6                    -  \n",
       "8                    -  \n",
       "...                ...  \n",
       "9995                 -  \n",
       "9996                 -  \n",
       "9997                 -  \n",
       "9998                 -  \n",
       "9999                 -  \n",
       "\n",
       "[7507 rows x 7 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2[df2[\"WINDSPEED\"]!=df3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "29abd03d-f3bb-4774-b9d6-2e3b0627469c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7520"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(df3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "5b06422d-74f2-448e-8021-5726c7e1e1d1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       -\n",
       "2       -\n",
       "4       -\n",
       "6       -\n",
       "8       -\n",
       "       ..\n",
       "9995    -\n",
       "9996    -\n",
       "9997    -\n",
       "9998    -\n",
       "9999    -\n",
       "Name: WINDSPEED, Length: 7520, dtype: object"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "4a69e657-08d7-496b-b142-47343ef34215",
   "metadata": {},
   "outputs": [],
   "source": [
    "df4 = df3.drop_duplicates()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "a5e9cfe3-2a43-43f3-8846-1712ce0c2da4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0         -\n",
       "3960    1-3\n",
       "Name: WINDSPEED, dtype: object"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "e89cd7e8-aef0-41bb-b745-b3db71a9d684",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(df4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "b3dec504-1b17-4572-8904-d10dc3854c12",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>WINDDIRECT</th>\n",
       "      <th>WINDSPEED</th>\n",
       "      <th>DDATETIME</th>\n",
       "      <th>ISBUILDWORD</th>\n",
       "      <th>MINRAIN</th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>PRIMARYFORECASTER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>盐田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>宝安区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9995</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>龙华新区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9996</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>大鹏新区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9997</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9998</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9999</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>7520 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     WINDDIRECT WINDSPEED            DDATETIME  ISBUILDWORD  MINRAIN AREANAME  \\\n",
       "0            东北         3  2015-01-07 16:00:00            0      0.0      福田区   \n",
       "2            东北         3  2015-01-07 16:00:00            0      0.0      罗湖区   \n",
       "4            东北         3  2015-01-07 16:00:00            0      0.0      南山区   \n",
       "6            东北         3  2015-01-07 16:00:00            0      0.0      盐田区   \n",
       "8            东北         3  2015-01-07 16:00:00            0      0.0      宝安区   \n",
       "...         ...       ...                  ...          ...      ...      ...   \n",
       "9995          东       2-3  2015-09-17 06:00:00            0      0.0     龙华新区   \n",
       "9996          东       2-3  2015-09-17 06:00:00            0      0.0     大鹏新区   \n",
       "9997          东       2-3  2015-09-17 11:00:00            0      0.0      福田区   \n",
       "9998          东       2-3  2015-09-17 11:00:00            0      0.0      罗湖区   \n",
       "9999          东       2-3  2015-09-17 11:00:00            0      0.0      南山区   \n",
       "\n",
       "     PRIMARYFORECASTER  \n",
       "0                    -  \n",
       "2                    -  \n",
       "4                    -  \n",
       "6                    -  \n",
       "8                    -  \n",
       "...                ...  \n",
       "9995                 -  \n",
       "9996                 -  \n",
       "9997                 -  \n",
       "9998                 -  \n",
       "9999                 -  \n",
       "\n",
       "[7520 rows x 7 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "5d92252a-565a-4589-8964-bc7208d5556b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['WINDDIRECT', 'WINDSPEED', 'DDATETIME', 'ISBUILDWORD', 'MINRAIN',\n",
       "       'AREANAME', 'PRIMARYFORECASTER'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "de4b6608-1209-4f70-b4d4-763c5f2d7ba7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0       None\n",
       "2        福田区\n",
       "4        罗湖区\n",
       "6        南山区\n",
       "8        盐田区\n",
       "        ... \n",
       "9995    坪山新区\n",
       "9996    龙华新区\n",
       "9997    大鹏新区\n",
       "9998     福田区\n",
       "9999     罗湖区\n",
       "Name: AREANAME, Length: 7520, dtype: object"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2.AREANAME.shift()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "79e61e7e-e1ed-4f29-b913-58f87cd40d9a",
   "metadata": {},
   "outputs": [],
   "source": [
    "df4 =df2[df2[\"AREANAME\"]==\"福田区\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "749343e3-bc7f-4f40-a906-c04e85ec54c8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>WINDDIRECT</th>\n",
       "      <th>WINDSPEED</th>\n",
       "      <th>DDATETIME</th>\n",
       "      <th>ISBUILDWORD</th>\n",
       "      <th>MINRAIN</th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>PRIMARYFORECASTER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-08 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-09 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-08 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>69</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-09 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9934</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-07 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9941</th>\n",
       "      <td>西南</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-08-29 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9983</th>\n",
       "      <td>东</td>\n",
       "      <td>2</td>\n",
       "      <td>2015-11-05 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9990</th>\n",
       "      <td>西南</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2016-06-13 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9997</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>756 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     WINDDIRECT WINDSPEED            DDATETIME  ISBUILDWORD  MINRAIN AREANAME  \\\n",
       "0            东北         3  2015-01-07 16:00:00            0      0.0      福田区   \n",
       "20           东北         3  2015-01-08 06:00:00            0      0.0      福田区   \n",
       "39           东北       2-3  2015-01-09 06:00:00            0      0.0      福田区   \n",
       "40           东北         3  2015-01-08 16:00:00            0      0.0      福田区   \n",
       "69           东北       2-3  2015-01-09 11:00:00            0      0.0      福田区   \n",
       "...         ...       ...                  ...          ...      ...      ...   \n",
       "9934         东北       2-3  2015-09-07 11:00:00            0      0.0      福田区   \n",
       "9941         西南       2-3  2015-08-29 16:00:00            0      0.0      福田区   \n",
       "9983          东         2  2015-11-05 16:00:00            0      0.0      福田区   \n",
       "9990         西南       2-3  2016-06-13 16:00:00            0      0.0      福田区   \n",
       "9997          东       2-3  2015-09-17 11:00:00            0      0.0      福田区   \n",
       "\n",
       "     PRIMARYFORECASTER  \n",
       "0                    -  \n",
       "20                   -  \n",
       "39                   -  \n",
       "40                   -  \n",
       "69                   -  \n",
       "...                ...  \n",
       "9934                 -  \n",
       "9941                 -  \n",
       "9983                 -  \n",
       "9990                 -  \n",
       "9997                 -  \n",
       "\n",
       "[756 rows x 7 columns]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "9ba3b295-7ff9-46e3-a432-16b0876ef9e8",
   "metadata": {},
   "outputs": [],
   "source": [
    "df4.reset_index(drop=True,inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "0db22bf0-4939-41e6-a1e6-b6abe5e5ce6d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>WINDDIRECT</th>\n",
       "      <th>WINDSPEED</th>\n",
       "      <th>DDATETIME</th>\n",
       "      <th>ISBUILDWORD</th>\n",
       "      <th>MINRAIN</th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>PRIMARYFORECASTER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-08 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-09 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-08 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-09 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>751</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-07 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>752</th>\n",
       "      <td>西南</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-08-29 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>753</th>\n",
       "      <td>东</td>\n",
       "      <td>2</td>\n",
       "      <td>2015-11-05 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>754</th>\n",
       "      <td>西南</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2016-06-13 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>755</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>756 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    WINDDIRECT WINDSPEED            DDATETIME  ISBUILDWORD  MINRAIN AREANAME  \\\n",
       "0           东北         3  2015-01-07 16:00:00            0      0.0      福田区   \n",
       "1           东北         3  2015-01-08 06:00:00            0      0.0      福田区   \n",
       "2           东北       2-3  2015-01-09 06:00:00            0      0.0      福田区   \n",
       "3           东北         3  2015-01-08 16:00:00            0      0.0      福田区   \n",
       "4           东北       2-3  2015-01-09 11:00:00            0      0.0      福田区   \n",
       "..         ...       ...                  ...          ...      ...      ...   \n",
       "751         东北       2-3  2015-09-07 11:00:00            0      0.0      福田区   \n",
       "752         西南       2-3  2015-08-29 16:00:00            0      0.0      福田区   \n",
       "753          东         2  2015-11-05 16:00:00            0      0.0      福田区   \n",
       "754         西南       2-3  2016-06-13 16:00:00            0      0.0      福田区   \n",
       "755          东       2-3  2015-09-17 11:00:00            0      0.0      福田区   \n",
       "\n",
       "    PRIMARYFORECASTER  \n",
       "0                   -  \n",
       "1                   -  \n",
       "2                   -  \n",
       "3                   -  \n",
       "4                   -  \n",
       "..                ...  \n",
       "751                 -  \n",
       "752                 -  \n",
       "753                 -  \n",
       "754                 -  \n",
       "755                 -  \n",
       "\n",
       "[756 rows x 7 columns]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "95982e2d-e5aa-4020-a212-a1dd78a78e4d",
   "metadata": {},
   "outputs": [],
   "source": [
    "df5 = df4.loc[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "6a63f659-68d8-4629-9edd-496e2eaacb34",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>WINDDIRECT</th>\n",
       "      <th>WINDSPEED</th>\n",
       "      <th>DDATETIME</th>\n",
       "      <th>ISBUILDWORD</th>\n",
       "      <th>MINRAIN</th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>PRIMARYFORECASTER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-08 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-09 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-08 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-09 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-15 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-15 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-16 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-16 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   WINDDIRECT WINDSPEED            DDATETIME  ISBUILDWORD  MINRAIN AREANAME  \\\n",
       "0          东北         3  2015-01-07 16:00:00            0      0.0      福田区   \n",
       "1          东北         3  2015-01-08 06:00:00            0      0.0      福田区   \n",
       "2          东北       2-3  2015-01-09 06:00:00            0      0.0      福田区   \n",
       "3          东北         3  2015-01-08 16:00:00            0      0.0      福田区   \n",
       "4          东北       2-3  2015-01-09 11:00:00            0      0.0      福田区   \n",
       "5          东北       2-3  2015-01-15 16:00:00            0      0.0      福田区   \n",
       "6          东北       2-3  2015-01-15 11:00:00            0      0.0      福田区   \n",
       "7          东北       2-3  2015-01-16 06:00:00            0      0.0      福田区   \n",
       "8          东北       2-3  2015-01-17 06:00:00            0      0.0      福田区   \n",
       "9          东北         3  2015-01-17 11:00:00            0      0.0      福田区   \n",
       "10         东北       2-3  2015-01-16 16:00:00            0      0.0      福田区   \n",
       "\n",
       "   PRIMARYFORECASTER  \n",
       "0                  -  \n",
       "1                  -  \n",
       "2                  -  \n",
       "3                  -  \n",
       "4                  -  \n",
       "5                  -  \n",
       "6                  -  \n",
       "7                  -  \n",
       "8                  -  \n",
       "9                  -  \n",
       "10                 -  "
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "58585af1-9526-4a62-8d84-67c4bf9aade0",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>WINDDIRECT</th>\n",
       "      <th>WINDSPEED</th>\n",
       "      <th>DDATETIME</th>\n",
       "      <th>ISBUILDWORD</th>\n",
       "      <th>MINRAIN</th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>PRIMARYFORECASTER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-08 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-09 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-08 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-09 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-15 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-15 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-16 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>None</td>\n",
       "      <td>None</td>\n",
       "      <td>东北</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-01-16 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   WINDDIRECT WINDSPEED DDATETIME ISBUILDWORD              MINRAIN  AREANAME  \\\n",
       "0        None      None        东北           3  2015-01-07 16:00:00         0   \n",
       "1        None      None        东北           3  2015-01-08 06:00:00         0   \n",
       "2        None      None        东北         2-3  2015-01-09 06:00:00         0   \n",
       "3        None      None        东北           3  2015-01-08 16:00:00         0   \n",
       "4        None      None        东北         2-3  2015-01-09 11:00:00         0   \n",
       "5        None      None        东北         2-3  2015-01-15 16:00:00         0   \n",
       "6        None      None        东北         2-3  2015-01-15 11:00:00         0   \n",
       "7        None      None        东北         2-3  2015-01-16 06:00:00         0   \n",
       "8        None      None        东北         2-3  2015-01-17 06:00:00         0   \n",
       "9        None      None        东北           3  2015-01-17 11:00:00         0   \n",
       "10       None      None        东北         2-3  2015-01-16 16:00:00         0   \n",
       "\n",
       "    PRIMARYFORECASTER  \n",
       "0                 0.0  \n",
       "1                 0.0  \n",
       "2                 0.0  \n",
       "3                 0.0  \n",
       "4                 0.0  \n",
       "5                 0.0  \n",
       "6                 0.0  \n",
       "7                 0.0  \n",
       "8                 0.0  \n",
       "9                 0.0  \n",
       "10                0.0  "
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df5.shift(2, axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "ec90157d-79f5-4565-9b5c-d2578c1a6af1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>WINDDIRECT</th>\n",
       "      <th>WINDSPEED</th>\n",
       "      <th>DDATETIME</th>\n",
       "      <th>ISBUILDWORD</th>\n",
       "      <th>MINRAIN</th>\n",
       "      <th>SYNC_ROWNUM</th>\n",
       "      <th>QPFRAIN</th>\n",
       "      <th>QPFISEDIT</th>\n",
       "      <th>MINTEMPERATURE</th>\n",
       "      <th>ISNEXTDAY</th>\n",
       "      <th>...</th>\n",
       "      <th>CRTTIME</th>\n",
       "      <th>RECID</th>\n",
       "      <th>QPFWEATHERPIC</th>\n",
       "      <th>WINDGUST</th>\n",
       "      <th>RAIN</th>\n",
       "      <th>MAXHUMIDITY</th>\n",
       "      <th>ISEDIT</th>\n",
       "      <th>WEATHERPIC</th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>PRIMARYFORECASTER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-01-08 15:59:49</td>\n",
       "      <td>61421</td>\n",
       "      <td>12.png</td>\n",
       "      <td>6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>0</td>\n",
       "      <td>12.png</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-01-08 15:59:49</td>\n",
       "      <td>61422</td>\n",
       "      <td>02.png</td>\n",
       "      <td>6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>0</td>\n",
       "      <td>02.png</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-01-08 15:59:49</td>\n",
       "      <td>61423</td>\n",
       "      <td>12.png</td>\n",
       "      <td>6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>0</td>\n",
       "      <td>12.png</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-01-08 15:59:49</td>\n",
       "      <td>61424</td>\n",
       "      <td>02.png</td>\n",
       "      <td>6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>0</td>\n",
       "      <td>02.png</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-01-08 15:59:49</td>\n",
       "      <td>61425</td>\n",
       "      <td>12.png</td>\n",
       "      <td>6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>0</td>\n",
       "      <td>12.png</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9995</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-09-17 17:59:39</td>\n",
       "      <td>76549</td>\n",
       "      <td>04.png</td>\n",
       "      <td>-</td>\n",
       "      <td>0.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>0</td>\n",
       "      <td>04.png</td>\n",
       "      <td>龙华新区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9996</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 06:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-09-17 17:59:39</td>\n",
       "      <td>76550</td>\n",
       "      <td>04.png</td>\n",
       "      <td>-</td>\n",
       "      <td>0.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>0</td>\n",
       "      <td>04.png</td>\n",
       "      <td>大鹏新区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9997</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-09-17 22:57:40</td>\n",
       "      <td>76561</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>-</td>\n",
       "      <td>0.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>1</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9998</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-09-17 22:57:40</td>\n",
       "      <td>76562</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>-</td>\n",
       "      <td>0.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>1</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9999</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-09-17 22:57:40</td>\n",
       "      <td>76563</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>-</td>\n",
       "      <td>0.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>1</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10000 rows × 27 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     WINDDIRECT WINDSPEED            DDATETIME  ISBUILDWORD  MINRAIN  \\\n",
       "0            东北         3  2015-01-07 16:00:00            0      0.0   \n",
       "1            东北         3  2015-01-07 16:00:00            0      0.0   \n",
       "2            东北         3  2015-01-07 16:00:00            0      0.0   \n",
       "3            东北         3  2015-01-07 16:00:00            0      0.0   \n",
       "4            东北         3  2015-01-07 16:00:00            0      0.0   \n",
       "...         ...       ...                  ...          ...      ...   \n",
       "9995          东       2-3  2015-09-17 06:00:00            0      0.0   \n",
       "9996          东       2-3  2015-09-17 06:00:00            0      0.0   \n",
       "9997          东       2-3  2015-09-17 11:00:00            0      0.0   \n",
       "9998          东       2-3  2015-09-17 11:00:00            0      0.0   \n",
       "9999          东       2-3  2015-09-17 11:00:00            0      0.0   \n",
       "\n",
       "     SYNC_ROWNUM  QPFRAIN  QPFISEDIT  MINTEMPERATURE  ISNEXTDAY  ...  \\\n",
       "0              -        0          0            13.0          0  ...   \n",
       "1              -        0          0             0.0          1  ...   \n",
       "2              -        0          0            14.0          0  ...   \n",
       "3              -        0          0             0.0          1  ...   \n",
       "4              -        0          0            14.0          0  ...   \n",
       "...          ...      ...        ...             ...        ...  ...   \n",
       "9995           -        0          0            26.0          0  ...   \n",
       "9996           -        0          0            26.0          0  ...   \n",
       "9997           -        0          0            28.0          0  ...   \n",
       "9998           -        0          0            28.0          0  ...   \n",
       "9999           -        0          0            27.0          0  ...   \n",
       "\n",
       "                  CRTTIME  RECID  QPFWEATHERPIC WINDGUST RAIN  MAXHUMIDITY  \\\n",
       "0     2015-01-08 15:59:49  61421         12.png        6  0.0         70.0   \n",
       "1     2015-01-08 15:59:49  61422         02.png        6  0.0         70.0   \n",
       "2     2015-01-08 15:59:49  61423         12.png        6  0.0         70.0   \n",
       "3     2015-01-08 15:59:49  61424         02.png        6  0.0         70.0   \n",
       "4     2015-01-08 15:59:49  61425         12.png        6  0.0         70.0   \n",
       "...                   ...    ...            ...      ...  ...          ...   \n",
       "9995  2015-09-17 17:59:39  76549         04.png        -  0.0         85.0   \n",
       "9996  2015-09-17 17:59:39  76550         04.png        -  0.0         85.0   \n",
       "9997  2015-09-17 22:57:40  76561       02_2.png        -  0.0         85.0   \n",
       "9998  2015-09-17 22:57:40  76562       02_2.png        -  0.0         85.0   \n",
       "9999  2015-09-17 22:57:40  76563       02_2.png        -  0.0         85.0   \n",
       "\n",
       "     ISEDIT WEATHERPIC  AREANAME PRIMARYFORECASTER  \n",
       "0         0     12.png       福田区                 -  \n",
       "1         0     02.png       福田区                 -  \n",
       "2         0     12.png       罗湖区                 -  \n",
       "3         0     02.png       罗湖区                 -  \n",
       "4         0     12.png       南山区                 -  \n",
       "...     ...        ...       ...               ...  \n",
       "9995      0     04.png      龙华新区                 -  \n",
       "9996      0     04.png      大鹏新区                 -  \n",
       "9997      1   02_2.png       福田区                 -  \n",
       "9998      1   02_2.png       罗湖区                 -  \n",
       "9999      1   02_2.png       南山区                 -  \n",
       "\n",
       "[10000 rows x 27 columns]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "bdac79bf-da0c-47a1-afa9-199736a7bbe5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "32.0"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"MINTEMPERATURE\"].max()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "9685db48-c704-426c-97ab-875768284c89",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>WINDDIRECT</th>\n",
       "      <th>WINDSPEED</th>\n",
       "      <th>DDATETIME</th>\n",
       "      <th>ISBUILDWORD</th>\n",
       "      <th>MINRAIN</th>\n",
       "      <th>SYNC_ROWNUM</th>\n",
       "      <th>QPFRAIN</th>\n",
       "      <th>QPFISEDIT</th>\n",
       "      <th>MINTEMPERATURE</th>\n",
       "      <th>ISNEXTDAY</th>\n",
       "      <th>...</th>\n",
       "      <th>CRTTIME</th>\n",
       "      <th>RECID</th>\n",
       "      <th>QPFWEATHERPIC</th>\n",
       "      <th>WINDGUST</th>\n",
       "      <th>RAIN</th>\n",
       "      <th>MAXHUMIDITY</th>\n",
       "      <th>ISEDIT</th>\n",
       "      <th>WEATHERPIC</th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>PRIMARYFORECASTER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-01-08 15:59:49</td>\n",
       "      <td>61421</td>\n",
       "      <td>12.png</td>\n",
       "      <td>6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>0</td>\n",
       "      <td>12.png</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>1 rows × 27 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "  WINDDIRECT WINDSPEED            DDATETIME  ISBUILDWORD  MINRAIN SYNC_ROWNUM  \\\n",
       "0         东北         3  2015-01-07 16:00:00            0      0.0           -   \n",
       "\n",
       "   QPFRAIN  QPFISEDIT  MINTEMPERATURE  ISNEXTDAY  ...              CRTTIME  \\\n",
       "0        0          0            13.0          0  ...  2015-01-08 15:59:49   \n",
       "\n",
       "   RECID  QPFWEATHERPIC WINDGUST RAIN  MAXHUMIDITY ISEDIT WEATHERPIC  \\\n",
       "0  61421         12.png        6  0.0         70.0      0     12.png   \n",
       "\n",
       "   AREANAME PRIMARYFORECASTER  \n",
       "0       福田区                 -  \n",
       "\n",
       "[1 rows x 27 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[0:1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "ddfe3526-6562-430b-9fa0-532bc77e1285",
   "metadata": {},
   "outputs": [],
   "source": [
    "df1 = df[df['AREANAME'].isin(['福田区','罗湖区','南山区'])]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "5b4bff26-57e7-4739-808e-332eec004a51",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>WINDDIRECT</th>\n",
       "      <th>WINDSPEED</th>\n",
       "      <th>DDATETIME</th>\n",
       "      <th>ISBUILDWORD</th>\n",
       "      <th>MINRAIN</th>\n",
       "      <th>SYNC_ROWNUM</th>\n",
       "      <th>QPFRAIN</th>\n",
       "      <th>QPFISEDIT</th>\n",
       "      <th>MINTEMPERATURE</th>\n",
       "      <th>ISNEXTDAY</th>\n",
       "      <th>...</th>\n",
       "      <th>CRTTIME</th>\n",
       "      <th>RECID</th>\n",
       "      <th>QPFWEATHERPIC</th>\n",
       "      <th>WINDGUST</th>\n",
       "      <th>RAIN</th>\n",
       "      <th>MAXHUMIDITY</th>\n",
       "      <th>ISEDIT</th>\n",
       "      <th>WEATHERPIC</th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>PRIMARYFORECASTER</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-01-08 15:59:49</td>\n",
       "      <td>61421</td>\n",
       "      <td>12.png</td>\n",
       "      <td>6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>0</td>\n",
       "      <td>12.png</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-01-08 15:59:49</td>\n",
       "      <td>61422</td>\n",
       "      <td>02.png</td>\n",
       "      <td>6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>0</td>\n",
       "      <td>02.png</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-01-08 15:59:49</td>\n",
       "      <td>61423</td>\n",
       "      <td>12.png</td>\n",
       "      <td>6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>0</td>\n",
       "      <td>12.png</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-01-08 15:59:49</td>\n",
       "      <td>61424</td>\n",
       "      <td>02.png</td>\n",
       "      <td>6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>0</td>\n",
       "      <td>02.png</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>东北</td>\n",
       "      <td>3</td>\n",
       "      <td>2015-01-07 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-01-08 15:59:49</td>\n",
       "      <td>61425</td>\n",
       "      <td>12.png</td>\n",
       "      <td>6</td>\n",
       "      <td>0.0</td>\n",
       "      <td>70.0</td>\n",
       "      <td>0</td>\n",
       "      <td>12.png</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9991</th>\n",
       "      <td>西南</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2016-06-13 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>...</td>\n",
       "      <td>2016-06-14 03:58:33</td>\n",
       "      <td>92722</td>\n",
       "      <td>04.png</td>\n",
       "      <td>-</td>\n",
       "      <td>0.0</td>\n",
       "      <td>95.0</td>\n",
       "      <td>0</td>\n",
       "      <td>04.png</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9992</th>\n",
       "      <td>西南</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2016-06-13 16:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>26.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2016-06-14 03:58:33</td>\n",
       "      <td>92723</td>\n",
       "      <td>06.png</td>\n",
       "      <td>-</td>\n",
       "      <td>0.0</td>\n",
       "      <td>95.0</td>\n",
       "      <td>0</td>\n",
       "      <td>06.png</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9997</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-09-17 22:57:40</td>\n",
       "      <td>76561</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>-</td>\n",
       "      <td>0.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>1</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>福田区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9998</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-09-17 22:57:40</td>\n",
       "      <td>76562</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>-</td>\n",
       "      <td>0.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>1</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>罗湖区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9999</th>\n",
       "      <td>东</td>\n",
       "      <td>2-3</td>\n",
       "      <td>2015-09-17 11:00:00</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>-</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>2015-09-17 22:57:40</td>\n",
       "      <td>76563</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>-</td>\n",
       "      <td>0.0</td>\n",
       "      <td>85.0</td>\n",
       "      <td>1</td>\n",
       "      <td>02_2.png</td>\n",
       "      <td>南山区</td>\n",
       "      <td>-</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3014 rows × 27 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     WINDDIRECT WINDSPEED            DDATETIME  ISBUILDWORD  MINRAIN  \\\n",
       "0            东北         3  2015-01-07 16:00:00            0      0.0   \n",
       "1            东北         3  2015-01-07 16:00:00            0      0.0   \n",
       "2            东北         3  2015-01-07 16:00:00            0      0.0   \n",
       "3            东北         3  2015-01-07 16:00:00            0      0.0   \n",
       "4            东北         3  2015-01-07 16:00:00            0      0.0   \n",
       "...         ...       ...                  ...          ...      ...   \n",
       "9991         西南       2-3  2016-06-13 16:00:00            0      0.0   \n",
       "9992         西南       2-3  2016-06-13 16:00:00            0      0.0   \n",
       "9997          东       2-3  2015-09-17 11:00:00            0      0.0   \n",
       "9998          东       2-3  2015-09-17 11:00:00            0      0.0   \n",
       "9999          东       2-3  2015-09-17 11:00:00            0      0.0   \n",
       "\n",
       "     SYNC_ROWNUM  QPFRAIN  QPFISEDIT  MINTEMPERATURE  ISNEXTDAY  ...  \\\n",
       "0              -        0          0            13.0          0  ...   \n",
       "1              -        0          0             0.0          1  ...   \n",
       "2              -        0          0            14.0          0  ...   \n",
       "3              -        0          0             0.0          1  ...   \n",
       "4              -        0          0            14.0          0  ...   \n",
       "...          ...      ...        ...             ...        ...  ...   \n",
       "9991           -        0          2             0.0          1  ...   \n",
       "9992           -        0          2            26.0          0  ...   \n",
       "9997           -        0          0            28.0          0  ...   \n",
       "9998           -        0          0            28.0          0  ...   \n",
       "9999           -        0          0            27.0          0  ...   \n",
       "\n",
       "                  CRTTIME  RECID  QPFWEATHERPIC WINDGUST RAIN  MAXHUMIDITY  \\\n",
       "0     2015-01-08 15:59:49  61421         12.png        6  0.0         70.0   \n",
       "1     2015-01-08 15:59:49  61422         02.png        6  0.0         70.0   \n",
       "2     2015-01-08 15:59:49  61423         12.png        6  0.0         70.0   \n",
       "3     2015-01-08 15:59:49  61424         02.png        6  0.0         70.0   \n",
       "4     2015-01-08 15:59:49  61425         12.png        6  0.0         70.0   \n",
       "...                   ...    ...            ...      ...  ...          ...   \n",
       "9991  2016-06-14 03:58:33  92722         04.png        -  0.0         95.0   \n",
       "9992  2016-06-14 03:58:33  92723         06.png        -  0.0         95.0   \n",
       "9997  2015-09-17 22:57:40  76561       02_2.png        -  0.0         85.0   \n",
       "9998  2015-09-17 22:57:40  76562       02_2.png        -  0.0         85.0   \n",
       "9999  2015-09-17 22:57:40  76563       02_2.png        -  0.0         85.0   \n",
       "\n",
       "     ISEDIT WEATHERPIC  AREANAME PRIMARYFORECASTER  \n",
       "0         0     12.png       福田区                 -  \n",
       "1         0     02.png       福田区                 -  \n",
       "2         0     12.png       罗湖区                 -  \n",
       "3         0     02.png       罗湖区                 -  \n",
       "4         0     12.png       南山区                 -  \n",
       "...     ...        ...       ...               ...  \n",
       "9991      0     04.png       福田区                 -  \n",
       "9992      0     06.png       罗湖区                 -  \n",
       "9997      1   02_2.png       福田区                 -  \n",
       "9998      1   02_2.png       罗湖区                 -  \n",
       "9999      1   02_2.png       南山区                 -  \n",
       "\n",
       "[3014 rows x 27 columns]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "ee27b454-5596-445f-bbf6-43f765ef9526",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AREANAME</th>\n",
       "      <th>count</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>南山区</td>\n",
       "      <td>1008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>福田区</td>\n",
       "      <td>1005</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>罗湖区</td>\n",
       "      <td>1001</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  AREANAME  count\n",
       "0      南山区   1008\n",
       "1      福田区   1005\n",
       "2      罗湖区   1001"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.groupby(['AREANAME']).size().reset_index(name='count')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "f53bf0b2-0573-45cc-8a5b-35b41effd442",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'福田区'"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1.AREANAME.values[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "95e92bce-1cd1-4b3c-aeb4-dc791be0649c",
   "metadata": {},
   "outputs": [],
   "source": [
    "temp=df1.groupby(['AREANAME'])['DDATETIME'].count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "74d92195-d66c-439e-aa3d-76d348c7f200",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "AREANAME\n",
       "南山区    1008\n",
       "福田区    1005\n",
       "罗湖区    1001\n",
       "Name: DDATETIME, dtype: int64"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "a5200e59-2a27-4be6-b19f-40299e46397d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pandas.core.series.Series"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(temp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "d446e700-96e7-4f80-af73-ce063d99d3ee",
   "metadata": {},
   "outputs": [],
   "source": [
    "temp = df1.AREANAME.values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "025f8af0-63c0-4a89-b8d4-2eb6faf13e01",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['福田区', '福田区', '罗湖区', ..., '福田区', '罗湖区', '南山区'], dtype=object)"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "38dc9388-3fed-4da4-ae92-d1703b77409b",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "7d0db58a-7e59-4fa8-872e-d9ae410692e8",
   "metadata": {},
   "outputs": [],
   "source": [
    "tmp= pd.DataFrame({'姓名':['A', 'B', 'C', 'A', 'B', 'C', 'A', 'B', 'C'],\n",
    "             '科目':['英语', '英语', '英语', '数学', '数学', '数学', '语文', '语文', '语文'],\n",
    "             '分数':[90, 60, 70, 80, 98, 80, 85, 90, 75]})\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "710c515c-ba2e-4748-8142-20f3b6712049",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>姓名</th>\n",
       "      <th>科目</th>\n",
       "      <th>分数</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A</td>\n",
       "      <td>英语</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>B</td>\n",
       "      <td>英语</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>C</td>\n",
       "      <td>英语</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>A</td>\n",
       "      <td>数学</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>B</td>\n",
       "      <td>数学</td>\n",
       "      <td>98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>C</td>\n",
       "      <td>数学</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>A</td>\n",
       "      <td>语文</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>B</td>\n",
       "      <td>语文</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>C</td>\n",
       "      <td>语文</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  姓名  科目  分数\n",
       "0  A  英语  90\n",
       "1  B  英语  60\n",
       "2  C  英语  70\n",
       "3  A  数学  80\n",
       "4  B  数学  98\n",
       "5  C  数学  80\n",
       "6  A  语文  85\n",
       "7  B  语文  90\n",
       "8  C  语文  75"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tmp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "5ce39d5a-8b72-4c96-9dcf-3a008d08387a",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=tmp.set_index(['姓名','科目'])['分数'].unstack()\n",
    "df.columns.name=None\n",
    "df=df.reset_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "17b352b2-8c06-40c7-810a-34c61622af09",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>分数</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>姓名</th>\n",
       "      <th>科目</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>A</th>\n",
       "      <th>英语</th>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <th>英语</th>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <th>英语</th>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>A</th>\n",
       "      <th>数学</th>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <th>数学</th>\n",
       "      <td>98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <th>数学</th>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>A</th>\n",
       "      <th>语文</th>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <th>语文</th>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <th>语文</th>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       分数\n",
       "姓名 科目    \n",
       "A  英语  90\n",
       "B  英语  60\n",
       "C  英语  70\n",
       "A  数学  80\n",
       "B  数学  98\n",
       "C  数学  80\n",
       "A  语文  85\n",
       "B  语文  90\n",
       "C  语文  75"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tmp.set_index(['姓名','科目'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "c7d9ef15-0868-4768-aee7-7c10d4c44aee",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>科目</th>\n",
       "      <th>数学</th>\n",
       "      <th>英语</th>\n",
       "      <th>语文</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>姓名</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>A</th>\n",
       "      <td>80</td>\n",
       "      <td>90</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <td>98</td>\n",
       "      <td>60</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <td>80</td>\n",
       "      <td>70</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "科目  数学  英语  语文\n",
       "姓名            \n",
       "A   80  90  85\n",
       "B   98  60  90\n",
       "C   80  70  75"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tmp.set_index(['姓名','科目'])['分数'].unstack()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "07e57fcd-4708-41ed-9e55-2b134c696fb1",
   "metadata": {},
   "outputs": [],
   "source": [
    "df=tmp.set_index(['姓名','科目'])['分数'].unstack()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "b3ba12b6-3e7f-443f-8dd6-cd4af20eaa9c",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.columns.name = None"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "2ded8c13-df2d-485c-ac30-eef78038310c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>数学</th>\n",
       "      <th>英语</th>\n",
       "      <th>语文</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>姓名</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>A</th>\n",
       "      <td>80</td>\n",
       "      <td>90</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>B</th>\n",
       "      <td>98</td>\n",
       "      <td>60</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <td>80</td>\n",
       "      <td>70</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    数学  英语  语文\n",
       "姓名            \n",
       "A   80  90  85\n",
       "B   98  60  90\n",
       "C   80  70  75"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "197256c1-e83b-4bb5-87e5-2cc93cd14489",
   "metadata": {},
   "outputs": [],
   "source": [
    "df.reset_index(inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "00ef09c7-a097-44a8-aaa2-8aca5d2d9ee9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>姓名</th>\n",
       "      <th>数学</th>\n",
       "      <th>英语</th>\n",
       "      <th>语文</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A</td>\n",
       "      <td>80</td>\n",
       "      <td>90</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>B</td>\n",
       "      <td>98</td>\n",
       "      <td>60</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>C</td>\n",
       "      <td>80</td>\n",
       "      <td>70</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  姓名  数学  英语  语文\n",
       "0  A  80  90  85\n",
       "1  B  98  60  90\n",
       "2  C  80  70  75"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "a4b709e6-8a4b-498c-b30e-6aa83efe5be0",
   "metadata": {},
   "outputs": [],
   "source": [
    "res = df.set_index(['姓名']).stack()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "92e69c32-24b0-4aac-a794-d64d2d583955",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "姓名    \n",
       "A   数学    80\n",
       "    英语    90\n",
       "    语文    85\n",
       "B   数学    98\n",
       "    英语    60\n",
       "    语文    90\n",
       "C   数学    80\n",
       "    英语    70\n",
       "    语文    75\n",
       "dtype: int64"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "3f8ad81b-d874-4505-a93f-9294166b4a76",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "MultiIndex([('A', '数学'),\n",
       "            ('A', '英语'),\n",
       "            ('A', '语文'),\n",
       "            ('B', '数学'),\n",
       "            ('B', '英语'),\n",
       "            ('B', '语文'),\n",
       "            ('C', '数学'),\n",
       "            ('C', '英语'),\n",
       "            ('C', '语文')],\n",
       "           names=['姓名', None])"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "6c020160-38fb-4bab-8365-661fe268ee07",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "FrozenList(['姓名', None])"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res.index.names"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "id": "23bbdf26-e779-41d7-b30d-925f3e24183d",
   "metadata": {},
   "outputs": [],
   "source": [
    "res.index.names = ['姓名', '科目']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "610e99ed-4cea-4ea6-91fd-517f5e533051",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "姓名  科目\n",
       "A   数学    80\n",
       "    英语    90\n",
       "    语文    85\n",
       "B   数学    98\n",
       "    英语    60\n",
       "    语文    90\n",
       "C   数学    80\n",
       "    英语    70\n",
       "    语文    75\n",
       "dtype: int64"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "1a6f69d4-3278-443d-aab7-7321e7fc8713",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>姓名</th>\n",
       "      <th>科目</th>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A</td>\n",
       "      <td>数学</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A</td>\n",
       "      <td>英语</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A</td>\n",
       "      <td>语文</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>B</td>\n",
       "      <td>数学</td>\n",
       "      <td>98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>B</td>\n",
       "      <td>英语</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>B</td>\n",
       "      <td>语文</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>C</td>\n",
       "      <td>数学</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>C</td>\n",
       "      <td>英语</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>C</td>\n",
       "      <td>语文</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  姓名  科目   0\n",
       "0  A  数学  80\n",
       "1  A  英语  90\n",
       "2  A  语文  85\n",
       "3  B  数学  98\n",
       "4  B  英语  60\n",
       "5  B  语文  90\n",
       "6  C  数学  80\n",
       "7  C  英语  70\n",
       "8  C  语文  75"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res.reset_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "f6e416ed-c729-437c-bcaf-1aa786aa977b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>姓名</th>\n",
       "      <th>科目</th>\n",
       "      <th>分数</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A</td>\n",
       "      <td>数学</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A</td>\n",
       "      <td>英语</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A</td>\n",
       "      <td>语文</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>B</td>\n",
       "      <td>数学</td>\n",
       "      <td>98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>B</td>\n",
       "      <td>英语</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>B</td>\n",
       "      <td>语文</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>C</td>\n",
       "      <td>数学</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>C</td>\n",
       "      <td>英语</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>C</td>\n",
       "      <td>语文</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  姓名  科目  分数\n",
       "0  A  数学  80\n",
       "1  A  英语  90\n",
       "2  A  语文  85\n",
       "3  B  数学  98\n",
       "4  B  英语  60\n",
       "5  B  语文  90\n",
       "6  C  数学  80\n",
       "7  C  英语  70\n",
       "8  C  语文  75"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res.reset_index(name=\"分数\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "575af8ec-c189-4862-94fe-8f37d4d68258",
   "metadata": {},
   "outputs": [],
   "source": [
    "res = res.reset_index(name=\"分数\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "b8359a1c-8431-40db-a473-5de8a830e433",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>姓名</th>\n",
       "      <th>科目</th>\n",
       "      <th>abc</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A</td>\n",
       "      <td>数学</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A</td>\n",
       "      <td>英语</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A</td>\n",
       "      <td>语文</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>B</td>\n",
       "      <td>数学</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>B</td>\n",
       "      <td>英语</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>B</td>\n",
       "      <td>语文</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>C</td>\n",
       "      <td>数学</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>C</td>\n",
       "      <td>英语</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>C</td>\n",
       "      <td>语文</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  姓名  科目  abc\n",
       "0  A  数学  NaN\n",
       "1  A  英语  NaN\n",
       "2  A  语文  NaN\n",
       "3  B  数学  NaN\n",
       "4  B  英语  NaN\n",
       "5  B  语文  NaN\n",
       "6  C  数学  NaN\n",
       "7  C  英语  NaN\n",
       "8  C  语文  NaN"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res.reindex(columns=['姓名','科目', 'abc'], )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "f62fb643-3ea8-4dfa-87d1-a99f1c8521aa",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['姓名', '科目', '分数'], dtype='object')"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "19522c61-6293-4b7d-8f5b-b8e52fce3290",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>姓名</th>\n",
       "      <th>科目test</th>\n",
       "      <th>分数test</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A</td>\n",
       "      <td>数学</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A</td>\n",
       "      <td>英语</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A</td>\n",
       "      <td>语文</td>\n",
       "      <td>85</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>B</td>\n",
       "      <td>数学</td>\n",
       "      <td>98</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>B</td>\n",
       "      <td>英语</td>\n",
       "      <td>60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>B</td>\n",
       "      <td>语文</td>\n",
       "      <td>90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>C</td>\n",
       "      <td>数学</td>\n",
       "      <td>80</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>C</td>\n",
       "      <td>英语</td>\n",
       "      <td>70</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>C</td>\n",
       "      <td>语文</td>\n",
       "      <td>75</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  姓名 科目test  分数test\n",
       "0  A     数学      80\n",
       "1  A     英语      90\n",
       "2  A     语文      85\n",
       "3  B     数学      98\n",
       "4  B     英语      60\n",
       "5  B     语文      90\n",
       "6  C     数学      80\n",
       "7  C     英语      70\n",
       "8  C     语文      75"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "res.rename(columns=lambda x: x if x==\"姓名\" else x+\"test\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "7e3b52a9-3518-44fd-beec-0daf3719ff55",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "df_round = pd.DataFrame(np.random.random([3, 3]),\n",
    "     columns=['A', 'B', 'C'])\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "91d3febb-c4c2-4a08-81ac-bf718ea3ca76",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.671201</td>\n",
       "      <td>0.076582</td>\n",
       "      <td>0.042476</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.377289</td>\n",
       "      <td>0.792163</td>\n",
       "      <td>0.127119</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.165595</td>\n",
       "      <td>0.639357</td>\n",
       "      <td>0.387696</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          A         B         C\n",
       "0  0.671201  0.076582  0.042476\n",
       "1  0.377289  0.792163  0.127119\n",
       "2  0.165595  0.639357  0.387696"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_round"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "93b9a34b-69df-418a-866d-e258b596a100",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    0.08\n",
       "1    0.79\n",
       "2    0.64\n",
       "Name: B, dtype: float64"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_round['B'].round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "e142584d-a359-46a9-914f-3baa457e531c",
   "metadata": {},
   "outputs": [],
   "source": [
    "df_round.loc[1, 'C'] = 0.3255"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "4e11c0f1-8423-4401-afad-b68928bda929",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.671201</td>\n",
       "      <td>0.076582</td>\n",
       "      <td>0.042476</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.377289</td>\n",
       "      <td>0.792163</td>\n",
       "      <td>0.325500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.165595</td>\n",
       "      <td>0.639357</td>\n",
       "      <td>0.387696</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          A         B         C\n",
       "0  0.671201  0.076582  0.042476\n",
       "1  0.377289  0.792163  0.325500\n",
       "2  0.165595  0.639357  0.387696"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_round"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "id": "268df7bf-c917-4c04-9671-582eaa26394e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    0.08\n",
       "1    0.79\n",
       "2    0.64\n",
       "Name: B, dtype: float64"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_round['B'].round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "id": "f2127919-08d7-4853-a17e-bc9ac3510883",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    0.04\n",
       "1    0.33\n",
       "2    0.39\n",
       "Name: C, dtype: float64"
      ]
     },
     "execution_count": 65,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_round['C'].round(3).round(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "id": "1be47b22-2e78-46a6-a786-ccf71fde8b0e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.67120081, 0.37728912, 0.1655955 ])"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_round['A'].values"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "id": "3bf1958b-8483-43b9-8ffc-3c782f48c020",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0.1655954982454595, 0.37728911652267194, 0.6712008118329859}"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "set(df_round['A'].values)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "e2c5c0ab-1c54-401c-b7ba-5ac849ee481e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "set()"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "set([])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "4a2b003f-52e9-4462-b3a7-c29fead26b3c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(set([]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "2529b14a-0f8c-4d89-9880-89a15a8d428f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.671201</td>\n",
       "      <td>0.076582</td>\n",
       "      <td>0.042476</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.377289</td>\n",
       "      <td>0.792163</td>\n",
       "      <td>0.325500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.165595</td>\n",
       "      <td>0.639357</td>\n",
       "      <td>0.387696</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          A         B         C\n",
       "0  0.671201  0.076582  0.042476\n",
       "1  0.377289  0.792163  0.325500\n",
       "2  0.165595  0.639357  0.387696"
      ]
     },
     "execution_count": 70,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_round"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "id": "7d5190ab-f658-4f88-8685-fb3ddd057227",
   "metadata": {},
   "outputs": [],
   "source": [
    "test = pd.DataFrame({'A':[123]})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "id": "8fe464b6-93e1-4577-b9f1-6f8f935f7212",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>123</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     A\n",
       "0  123"
      ]
     },
     "execution_count": 72,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "2f999e81-88bd-4da3-821c-37a0bec54594",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.671201</td>\n",
       "      <td>0.076582</td>\n",
       "      <td>0.042476</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.377289</td>\n",
       "      <td>0.792163</td>\n",
       "      <td>0.325500</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.165595</td>\n",
       "      <td>0.639357</td>\n",
       "      <td>0.387696</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>123.000000</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            A         B         C\n",
       "0    0.671201  0.076582  0.042476\n",
       "1    0.377289  0.792163  0.325500\n",
       "2    0.165595  0.639357  0.387696\n",
       "3  123.000000       NaN       NaN"
      ]
     },
     "execution_count": 73,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_round._append(test, ignore_index=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "7615898b-0df4-4ad1-bec2-179bc80fe5b3",
   "metadata": {},
   "outputs": [],
   "source": [
    "t1 ={'A':[123]}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "id": "1b0ce81d-cf09-47be-af2d-e6c11bbd7e9d",
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'DataFrame' object has no attribute 'append'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "Cell \u001b[1;32mIn[75], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[43mdf_round\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mappend\u001b[49m(t1, ignore_index\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n",
      "File \u001b[1;32mC:\\something\\Python39\\lib\\site-packages\\pandas\\core\\generic.py:6204\u001b[0m, in \u001b[0;36mNDFrame.__getattr__\u001b[1;34m(self, name)\u001b[0m\n\u001b[0;32m   6197\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (\n\u001b[0;32m   6198\u001b[0m     name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_internal_names_set\n\u001b[0;32m   6199\u001b[0m     \u001b[38;5;129;01mand\u001b[39;00m name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_metadata\n\u001b[0;32m   6200\u001b[0m     \u001b[38;5;129;01mand\u001b[39;00m name \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_accessors\n\u001b[0;32m   6201\u001b[0m     \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_info_axis\u001b[38;5;241m.\u001b[39m_can_hold_identifiers_and_holds_name(name)\n\u001b[0;32m   6202\u001b[0m ):\n\u001b[0;32m   6203\u001b[0m     \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m[name]\n\u001b[1;32m-> 6204\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mobject\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__getattribute__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m\n",
      "\u001b[1;31mAttributeError\u001b[0m: 'DataFrame' object has no attribute 'append'"
     ]
    }
   ],
   "source": [
    "df_round.append(t1, ignore_index=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6c16bf31-46f1-4a32-aff2-3542fb8bd540",
   "metadata": {},
   "outputs": [],
   "source": [
    "s1 = set([1,2,3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "23bca016-0764-4b18-bafe-a1d2fc8bb041",
   "metadata": {},
   "outputs": [],
   "source": [
    "s2 = set([1,4,6])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d8469a9e-7920-4b44-a32c-0b38ddc8e45e",
   "metadata": {},
   "outputs": [],
   "source": [
    "s1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a345b937-3bb2-4663-b145-1105816cf2ce",
   "metadata": {},
   "outputs": [],
   "source": [
    "s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "50efd92f-799c-42ba-ba68-3f70b8f4203d",
   "metadata": {},
   "outputs": [],
   "source": [
    "s1 -s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8b013d6f-a9e4-41ee-87cc-841fc21cf64e",
   "metadata": {},
   "outputs": [],
   "source": [
    "s1 ^s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "id": "9d1a632b-a8d8-4cf5-b755-2086d14b40b3",
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.DataFrame({'yourname':['a','a','b','c','d','d']}\n",
    "                 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "id": "9d908dbd-7faa-419a-bce6-715f9c86d798",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>yourname</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>a</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>b</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>c</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>d</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>d</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  yourname\n",
       "0        a\n",
       "1        a\n",
       "2        b\n",
       "3        c\n",
       "4        d\n",
       "5        d"
      ]
     },
     "execution_count": 79,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "id": "8a4a38dd-e6a2-48e4-9a06-51c63501ed12",
   "metadata": {},
   "outputs": [],
   "source": [
    "df['age'] = [1,2,3,4,5,6]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "id": "13495ab5-6778-4b25-8d3d-d0a179dc0516",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>yourname</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>a</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>a</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>b</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>c</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>d</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>d</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  yourname  age\n",
       "0        a    1\n",
       "1        a    2\n",
       "2        b    3\n",
       "3        c    4\n",
       "4        d    5\n",
       "5        d    6"
      ]
     },
     "execution_count": 81,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "id": "d96d8cbf-db03-4976-a4e6-43ecfd82f4af",
   "metadata": {},
   "outputs": [],
   "source": [
    "df['max_age'] = df[df['age']>2].groupby('yourname')['age'].transform('max')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "id": "c07f4dc1-48eb-45e8-9228-c69380a32111",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>yourname</th>\n",
       "      <th>age</th>\n",
       "      <th>max_age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>a</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>a</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>b</td>\n",
       "      <td>3</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>c</td>\n",
       "      <td>4</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>d</td>\n",
       "      <td>5</td>\n",
       "      <td>6.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>d</td>\n",
       "      <td>6</td>\n",
       "      <td>6.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  yourname  age  max_age\n",
       "0        a    1      NaN\n",
       "1        a    2      NaN\n",
       "2        b    3      3.0\n",
       "3        c    4      4.0\n",
       "4        d    5      6.0\n",
       "5        d    6      6.0"
      ]
     },
     "execution_count": 83,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 86,
   "id": "02977038-7724-43ec-962c-3b40575fcf88",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5.25"
      ]
     },
     "execution_count": 86,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "round(5.253, 2)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6b474299-be29-47d6-be7b-5f57d735a869",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "71a322f5-1d0c-4805-a45c-377b894a53fc",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "548c1ef9-5f1e-4fdc-9401-84f154a34ec5",
   "metadata": {},
   "outputs": [],
   "source": [
    "s1 = []"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "aa23fb37-aeaf-4127-a3c2-88392166ffe5",
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(10):\n",
    "    a = {i:i}\n",
    "    s1.append(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f25d4ff6-1d69-436f-8ff1-0cc5dff334b9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[{0: 0},\n",
       " {1: 1},\n",
       " {2: 2},\n",
       " {3: 3},\n",
       " {4: 4},\n",
       " {5: 5},\n",
       " {6: 6},\n",
       " {7: 7},\n",
       " {8: 8},\n",
       " {9: 9}]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2b7ae6a1-67cf-4678-85d6-9485b1696718",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
